﻿<%@ Page Title="Cungmuanao.com - Quản lý liên hệ" Language="C#" MasterPageFile="~/Admin/Admin.master" 
   AutoEventWireup="true" CodeFile="ManageSupport.aspx.cs" Inherits="ManageSupport" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="LeftContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <div class="title">Quản lý liên hệ</div>
    <div class="body">
    <asp:GridView ID="gvwSupports" runat="server" AutoGenerateColumns="False" 
           DataSourceID="objAllSupports" Width="100%" DataKeyNames="ID" 
           OnRowDeleted="gvwSupports_RowDeleted" OnRowCreated="gvwSupports_RowCreated" 
   OnSelectedIndexChanged="gvwSupports_SelectedIndexChanged">
      <Columns>
         
        <asp:TemplateField HeaderText="STT">
            <ItemStyle HorizontalAlign="Center" Width="20px" />
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblSTT" Text='<%#Container.DataItemIndex + 1 %>' />
            </ItemTemplate>
        </asp:TemplateField>         
         
         <asp:TemplateField HeaderText="Tiêu đề">
            <ItemTemplate>
               <div class="">
               <asp:Literal runat="server" ID="lblTitle" Text='<%# Eval("Title") %>' />
               </div>              
            </ItemTemplate>
         </asp:TemplateField>                             
                                      
         <asp:TemplateField HeaderText="Yahoo">
         <ItemStyle HorizontalAlign="Center" />
            <ItemTemplate>               
               <asp:Literal runat="server" ID="lblYahoo" Text='<%# Eval("Yahoo") %>' />
            </ItemTemplate>
         </asp:TemplateField>  
         
         <asp:TemplateField HeaderText="Skype">
            <ItemStyle HorizontalAlign="Center" />
            <ItemTemplate>               
               <asp:Literal runat="server" ID="lblSkype" Text='<%# Eval("Skype") %>' />
            </ItemTemplate>
         </asp:TemplateField>                            
         
         <asp:TemplateField HeaderText="Hiện Yahoo">
         <ItemStyle HorizontalAlign="Center" Width="80px" />
            <ItemTemplate>               
               <asp:CheckBox ID="chkShowYahoo" runat="server" Enabled="false" Checked='<%# Bind("ShowYahoo") %>' />  
            </ItemTemplate>
         </asp:TemplateField>          

         <asp:TemplateField HeaderText="Hiện Skype">
         <ItemStyle HorizontalAlign="Center" Width="80px" />
            <ItemTemplate>               
               <asp:CheckBox ID="chkShowSkype" runat="server" Enabled="false" Checked='<%# Bind("ShowSkype") %>' />  
            </ItemTemplate>
         </asp:TemplateField>                 
         
         <asp:CommandField HeaderText="S&#7917;a" ButtonType="Image" SelectImageUrl="~/Images/Edit.gif" SelectText="Edit Support" ShowSelectButton="True">
            <ItemStyle HorizontalAlign="Center" Width="20px" />
         </asp:CommandField>
         
         <asp:CommandField HeaderText="Xóa" ButtonType="Image" DeleteImageUrl="~/Images/Delete.gif" DeleteText="Delete Support" ShowDeleteButton="True">
            <ItemStyle HorizontalAlign="Center" Width="20px" />
         </asp:CommandField>
      </Columns>
      <EmptyDataTemplate><b>Hiện chưa có thông tin nào.</b></EmptyDataTemplate>   
   </asp:GridView>
   
   <asp:ObjectDataSource ID="objAllSupports" runat="server" SelectMethod="ListSupport"
      TypeName="BLL.Faq.Support" DeleteMethod="DeleteSupport" >
       <DeleteParameters>
           <asp:Parameter Name="id" Type="Int32" />
       </DeleteParameters>
   </asp:ObjectDataSource>
   <p></p>
   <asp:DetailsView ID="dvwSupport" runat="server" AutoGenerateRows="False" DataSourceID="objCurrSupport" 
   Height="50px" Width="100%" 
   HeaderText="Thông tin" OnItemInserted="dvwSupport_ItemInserted" 
            OnItemUpdated="dvwSupport_ItemUpdated" DataKeyNames="ID" 
            OnItemCreated="dvwSupport_ItemCreated" DefaultMode="Insert" 
            OnItemCommand="dvwSupport_ItemCommand" 
            onmodechanged="dvwSupport_ModeChanged" onmodechanging="dvwSupport_ModeChanging">
      <FieldHeaderStyle Width="150px" />
      <Fields>
  <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID" InsertVisible="False" />
         <asp:BoundField DataField="AddedDate" HeaderText="Ngày t&#7841;o" InsertVisible="False"
            ReadOnly="True" SortExpression="AddedDate" />
         <asp:BoundField DataField="AddedBy" HeaderText="Ng&#432;&#7901;i t&#7841;o" InsertVisible="False" ReadOnly="True"
            SortExpression="AddedBy" />
         
         <asp:TemplateField HeaderText="Tiêu đề" >
            <ItemTemplate>
               <asp:Label ID="lblTitle" runat="server" Text='<%# Eval("Title") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:TextBox ID="txtTitle" runat="server" Text='<%# Bind("Title") %>' MaxLength="256" Width="100%"></asp:TextBox>
               <asp:RequiredFieldValidator ID="valRequireBranchTitle" runat="server" ControlToValidate="txtTitle" SetFocusOnError="true"
                  Text="B&#7855;t bu&#7897;c nh&#7853;p tiêu đề." ToolTip="B&#7855;t bu&#7897;c nh&#7853;p tiêu đề." Display="Dynamic"></asp:RequiredFieldValidator>
            </EditItemTemplate>
         </asp:TemplateField>    
         
         <asp:TemplateField HeaderText="Yahoo" SortExpression="Yahoo">
            <ItemTemplate>
               <asp:Label ID="lblYahoo" runat="server" Text='<%# Eval("Yahoo") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:TextBox ID="txtYahoo" runat="server" Text='<%# Bind("Yahoo") %>' MaxLength="256" Width="100%"></asp:TextBox>               
            </EditItemTemplate>
         </asp:TemplateField>  
         <asp:TemplateField HeaderText="Hi&#7879;n Yahoo" SortExpression="ShowYahoo">
            <ItemTemplate>
               <asp:Label ID="lblShowYahoo" runat="server" Text='<%# Eval("ShowYahoo") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:CheckBox ID="chkShowYahoo" runat="server" Checked='<%# Bind("ShowYahoo") %>' />
            </EditItemTemplate>
         </asp:TemplateField>  
         
         <asp:TemplateField HeaderText="Skype" >
            <ItemTemplate>
               <asp:Label ID="lblSkype" runat="server" Text='<%# Eval("Skype") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:TextBox ID="txtSkype" runat="server" Text='<%# Bind("Skype") %>' MaxLength="256" Width="100%"></asp:TextBox>               
            </EditItemTemplate>
         </asp:TemplateField>  
         <asp:TemplateField HeaderText="Hi&#7879;n Skype" SortExpression="ShowSkype">
            <ItemTemplate>
               <asp:Label ID="lblShowSkype" runat="server" Text='<%# Eval("ShowSkype") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:CheckBox ID="chkShowSkype" runat="server" Checked='<%# Bind("ShowSkype") %>' />
            </EditItemTemplate>
         </asp:TemplateField>   
         
         <asp:TemplateField HeaderText="Hi&#7879;n nhân viên này" >
            <ItemTemplate>
               <asp:Label ID="lblVisible" runat="server" Text='<%# Eval("Visible") %>'></asp:Label>
            </ItemTemplate>
            <EditItemTemplate>
               <asp:CheckBox ID="chkVisible" runat="server" Checked='<%# Bind("Visible") %>' />
            </EditItemTemplate>
         </asp:TemplateField>                                
                               
                      
          <asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/nhaplai.png" 
              CancelText="Nhập  lại" InsertImageUrl="~/Images/themmoi.png" 
              InsertText="Thêm mới" ShowInsertButton="True" ShowEditButton="True"
              UpdateImageUrl="~/Images/capnhat.png" UpdateText="Cập nhật" />         
         
      </Fields>
   </asp:DetailsView>
   
   <asp:ObjectDataSource ID="objCurrSupport" runat="server" InsertMethod="InsertSupport" 
           SelectMethod="GetSupport" TypeName="BLL.Faq.Support" 
           UpdateMethod="UpdateSupport">
       <UpdateParameters>
           <asp:Parameter Name="id" Type="Int32" />
           <asp:Parameter Name="title" Type="String" />
           <asp:Parameter Name="yahoo" Type="String" />
           <asp:Parameter Name="skype" Type="String" />
           <asp:Parameter Name="showYahoo" Type="Boolean" />
           <asp:Parameter Name="showSkype" Type="Boolean" />
           <asp:Parameter Name="visible" Type="Boolean" />
       </UpdateParameters>
      <SelectParameters>
         <asp:ControlParameter ControlID="gvwSupports" Name="SupportID" PropertyName="SelectedValue"
            Type="Int32" DefaultValue="" />
      </SelectParameters>
       <InsertParameters>
           <asp:Parameter Name="title" Type="String" />
           <asp:Parameter Name="yahoo" Type="String" />
           <asp:Parameter Name="skype" Type="String" />
           <asp:Parameter Name="showYahoo" Type="Boolean" />
           <asp:Parameter Name="showSkype" Type="Boolean" />
           <asp:Parameter Name="visible" Type="Boolean" />
       </InsertParameters>
   </asp:ObjectDataSource>
    </div>
    <div class="bottom"></div>
</asp:Content>

